<template>
  <div class="wrapper">
   <swiper :options="swiperOption" ref="mySwiper" v-if="showSwiper">
    <!-- slides -->
    <swiper-slide v-for="item of List" :key="item.id">
      <img class="swiper_img" :src="item.imgUrl"  alt="" >
    </swiper-slide>
   <!--  <swiper-slide>
      <img class="swiper_img" alt="">
    </swiper-slide> -->
    <!-- Optional controls -->
    <div class="swiper-pagination"  slot="pagination"></div>
  </swiper>
</div>
</template>
<script>
export default {
  name: 'HomeSwiper',
  props: {
    List: Array
  },
  data: function () {
    return {
      swiperOption: {
        pagination: '.swiper-pagination',
        loop: true
      }
    }
  },
  computed: {
    showSwiper: function () {
      return this.List.length
    }
  }
}
</script>

<style lang="stylus" scoped>
>>> .swiper-pagination-bullet-active{
background: red;
}
.wrapper {
width: 100%;
overflow: hidden;
height: 0;
padding-bottom: 31.5%;
}
.swiper_img {
width: 100%;
}
</style>
